package com.cz.mes;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;

import java.io.File;
import java.util.List;
import java.util.stream.Collectors;

public class ExcelReadHistorySku {
    public static void main(String[] args) {
        String skuList= "";
        File historySkuFile = new File("C:\\Users\\root\\Documents\\WXWork\\1688857842672779\\Cache\\File\\2025-04\\历史生产订单型号.xlsx");
        ExcelReader excelReader = ExcelUtil.getReader(historySkuFile);
        List<List<Object>> skuData = excelReader.read();
        if(CollUtil.isNotEmpty(skuData)){
             skuList = skuData.stream()
                    .map(sku -> sku.get(0).toString().trim())
                    .collect(Collectors.joining(","));
            FileUtil.writeString(skuList,new File("d:\\historySku.txt"),"UTF-8");
        }

    }
}
